// "Copyright [2021] <Copyright Shengkai Lin>"

#include "route.h"

namespace ai_sim {
RouteAlgorithm* RouteAlgorithm::get(ClusterType type) {
    if (type == ClusterType::OpticalCluster) {
        return new OxcClusterRouteAlgorithm();
    } else if (type == ClusterType::HybridCluster) {
        return new OxcClusterRouteAlgorithm();
    } else if (type == ClusterType::ElectricalCluster) {
        return new RoceClusterRouteAlgorithm();
    } else if (type == ClusterType::IbCluster) {
        return new IBClusterRouteAlgorithm();
    } else {
        throw omnetpp::cRuntimeError("DONT SUPPORT THE CLUSTER TYPE");
        return nullptr;
    }
}

bool RouteAlgorithm::selectInMachine(
    omnetpp::cModule* mod, void * parent) {
    return mod->getParentModule() == (omnetpp::cModule*)parent;
}
}  // namespace ai_sim
